<template>
  <div class="container">
    <div class="head-top">
      <span>关于我们</span>
      <img @click="$router.push({name:'My',params:{index:4}})" src="static/img/return.png" />
    </div>

    <div class="listBox" style="position: relative;text-align: center">
      <div
        style="width: 3.5rem;height: 3.5rem;text-align: center;position: relative;margin: 0rem auto 0rem auto"
      >
        <img src="static/img/1000x1000.png" style="width: 100%;height: 100%;" />
      </div>
      <div
        style="text-align: center;position: relative;margin: 1rem auto 0rem auto;font-size: 1.05rem"
      >MCOIN</div>
      <div
        style="text-align: center;position: relative;margin: 0.2rem auto 0rem auto;color:gray;font-size: .9rem"
      >v1.1.18 cp24</div>
    </div>

    <div class="listBox2" style="position: relative;text-align: center;background: #fff">
      <div class="box" @click="showUpdate">
        <div style="display: inline-block;float: left">版本更新</div>
        <div
          style="display: inline-block;float: right;font-size: .9rem;width: 2rem;height:100%;text-align: right;padding-top: .1rem"
        >
          <img src="static/img/go.png" style="width: .8rem;height: .8rem" />
        </div>
      </div>
      <div class="box">
        <div style="display: inline-block;float: left">website</div>
        <div style="display: inline-block;float: right;font-size: .9rem;">
          <a
            style="color:#078AE4"
            href="https://twitter.com/CoinMedallion"
          >https://twitter.com/CoinMedallion</a>
        </div>
      </div>
    </div>
  </div>
</template>


<script>
import { Toast } from "vant";
import Clipboard from "clipboard";
import { mapGetters, mapActions } from "vuex";

export default {
  components: {},
  data() {
    return {
      msgList: [],
    };
  },
  created() {
    this.msgList = [].concat(this.messageList);

    this.msgList.reverse();
    let date = (new Date().getTime() + "").substring(0, 10);
    for (let i = 0; i < this.msgList.length; i++) {
      let obj = this.msgList[i];
      let timeStamp = parseInt((obj.timeStamp + "").substring(0, 10));

      let subtract = date - timeStamp;

      if (subtract < 1) {
        obj.date = "1秒前";
      } else if (subtract < 60) {
        obj.date = subtract.toFixed(0) + "秒前";
      } else if (subtract < 60 * 60) {
        obj.date = (subtract / 60).toFixed(0) + " 分前";
      } else if (subtract > 60 * 60 && subtract < 60 * 60 * 24) {
        obj.date = (subtract / 60 / 60).toFixed(0) + " 小时前";
      } else if (subtract > 60 * 60 * 24 && subtract < 60 * 60 * 24 * 30) {
        obj.date = (subtract / 60 / 60 / 24).toFixed(0) + " 日前";
      } else {
        obj.date = this.formatDateTime(timeStamp * 1000);
      }
    }
  },
  computed: {
    ...mapGetters(["currentAccount", "wallet", "accountIndex", "messageList"]),
  },
  methods: {
    ...mapActions(["setWallet", "setAccountIndex", "setMessageList"]),
    copy() {
      new Clipboard("#getHash", {
        text: function (trigger) {
          Dialog.alert({
            title: "提示",
            message: "已成功复制到剪切板",
          }).then(() => {
            // on close
          });
          return trigger.getAttribute("href"); // 返回需要复制的内容
        },
      });
    },
    readTX(index, msg) {
      let list = [].concat(this.msgList);
      list[index].isRead = true;
      list = list.reverse();
      this.setMessageList(list);

      this.$router.push({
        name: "MyTransactionInfo",
        params: { tran: msg.tran },
      });
    },
    readAll() {
      for (let i = 0; i < this.msgList.length; i++) {
        this.msgList[i].isRead = true;
      }
      let list = [].concat(this.msgList);
      list = list.reverse();
      this.setMessageList(list);
    },
    showUpdate() {
      Toast.loading({
        message: "检查更新中...",
        forbidClick: true,
        loadingType: "spinner",
      });

      setTimeout(() => {
        Toast.success("已是最新版本");
      }, 2000);
    },
  },

  async mounted() {},
};
</script>
<style lang="less" scoped>
* {
  box-sizing: border-box;
}
.container {
  width: 100%;
  height: 100%;
  padding: 0px;
  overflow: hidden;
  background: #fbfcfe;
  /*overflow-y: scroll;*/
}

.head-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  box-shadow: 0px 1px 12px 3px rgba(165, 172, 232, 0.26);

  div {
    position: absolute;
    right: 1.5625rem;
    font-size: 15px;
    color: #3246df;
  }

  span {
    font-size: 18px;
    color: #323232;
  }

  img {
    width: 0.6875rem;
    height: auto;
    position: absolute;
    left: 1.5625rem;
    top: 50%;
    transform: translateY(-50%);
  }
}

.listBox {
  height: auto;
  width: 100%;
  background: #fbfcfe;
  box-sizing: border-box;
  position: relative;
  padding: 2rem 0rem;
}

.listBox2 {
  padding: 0rem 0.2rem 0rem 0.8rem;
}
.listBox2 .box {
  font-size: 1rem;
  font-weight: 500;
  height: 4rem;
  background: #fff;
  text-align: left;
  padding: 1.5rem 0.5rem 0rem 0.3rem;
  border-bottom: 1px rgba(155, 155, 155, 0.1) solid;
}
</style>

